package com.stt.order.base.controller;

import com.stt.order.model.Order;
import com.stt.order.base.service.DiscountService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/api/orders")
public class OrderController {
    
    @Autowired
    private DiscountService discountService;
    
    @PostMapping("/calculate")
    public Order calculateOrderDiscount(@RequestBody Order order) {
        discountService.calculateDiscount(order);
        return order;
    }
} 